import { createApp } from 'vue'
import { Toast, Lazyload } from 'vant'
import App from './App.vue'
import './registerServiceWorker'
import router from '@/router'
import store from '@/store'
import i18n from '@/i18n'
import directives from '@/directives/index'

import '@/assets/css/public.less'

const app = createApp(App)

app.config.globalProperties.$toast = Toast

app.config.errorHandler = function (err, vm, info) {
  if (process.env.NODE_ENV === 'development') {
    console.log('err', err)
    console.log('vm', vm)
    console.log('info', info)
  }
  // handle error
  // `info` 是 Vue 特定的错误信息，比如错误所在的生命周期钩子
}
app
  .use(Lazyload)
  .use(directives)
  .use(store)
  .use(router)
  .use(i18n)
  .mount('#app')
